
import {
    CommentOutlined
} from '@ant-design/icons';
import { useNavigate, useLocation } from "react-router-dom";
import { Menu } from "antd";
const LeftMenu = () => {
    const navigateTo = useNavigate();
    const currentRoute = useLocation();
    
    function getItem(label, key, icon, children) {
        return {
          key,
          icon,
          children,
          label,
        };
      }
      const menus = [
        getItem('站内信', '/notice', <CommentOutlined />),
       
      ];
    const menuClick = (e) => {
        console.log(e.key)
        navigateTo(e.key);
    };
    const handleOpenChange = (keys) => {
        console.log(keys)
        // setOpenKeys([keys[keys.length - 1]]);
    };
    return (
        <Menu
            theme="dark"
            defaultSelectedKeys={'/notice'}
            mode="inline"
            // 菜单项的数据
            items={menus}
            onClick={menuClick}
            // 某项菜单展开和回收的事件
            onOpenChange={handleOpenChange}
            // 当前菜单展开项的key数组
            // openKeys={openKeys}
        />
    );
};

function findInitKey(menus, path) {
    const item = menus?.find((item) =>
        path.includes(item.key),
    );
    return item?.key;
}

export default LeftMenu;